;( function () {
	"use strict";
    var param_map = Result.getLocationParamObject();
    var global_param_map;
	
	$( function () {
		queryArticleList();
	}); 

	
	/**
	 * 收藏列表
	 */
	function queryArticleList(){
		var params = {
		};
		var $template = $( "#template" ),
       		$list = $( "#list" );
		
		$.ajax(getAjaxOps('/article/qryArticleList', params)
		).done(function(res){
			var data = res.data;
            if(res.resultCode == 0) {
            	$list.empty();
                if( $.isArray( data ) ) {
                	for( var i = 0, l = data.length; i < l; i++ ) {
               			var obj = $template.clone().removeAttr( "id" );
                    	$list.append( Result.fillData( obj, data[i], "field" ));
                    }
               	}
                init();
            } else {
            	$("body").tips(res.data);
            }
	    });
	}
	
	function init(){
		$("#list").find(".desc").click(function(){
			var descId = $(this).attr("descId");
			Result.forward("helpDetail.html", {"desc_id" : descId});
			return;
		});
	}
	
	
	window.replace_article_name = function ( $field, article_name , rowVal ) {
		$field.html(article_name);
		$field.attr("descId", rowVal["id"]);
	};
	
	window.replace_photo = function ( $field, photo, rowVal ) {
		$field.attr("src", IMG_PRE + photo);
	};
	
	/**
	 * 跳到首页
	 */
	window.toIndex = function(){
		Result.forward("index.html", {});
	};
	
	/**
	 * 跳到用户信息
	 */
	window.toUserInfo = function(){
		Result.forward("userInfos.html", {});
	};
	
	
}( window ) );
